home *** CD-ROM | disk | FTP | other *** search
/ US Department of Defense…ndamentals 1.0 2004 April / US Department of Defense: Firewall & Router Fundamentals 1.0 2004 April.iso / text_only / includes / api_functions.js next >
Text File  |  2004-04-30  |  28KB  |  831 lines

  1. function find_api(win)
  2. {
  3.     while ((win.API == null) && (win.parent != null) && (win.parent != win))
  4.     {
  5.         FIND_API_TRIES++;
  6.         if (FIND_API_TRIES > 7)
  7.         {
  8.             return null;
  9.         }
  10.  
  11.         win = win.parent;
  12.     }
  13.     return win.API;
  14. }
  15.  
  16. function get_api()
  17. {
  18.     var theAPI = find_api(window);
  19.  
  20.     if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined"))
  21.     {
  22.         theAPI = find_api(window.opener);
  23.     }
  24.     return theAPI
  25. }
  26.  
  27. function write_screen()
  28. {
  29.   var obj_style = null;
  30.   
  31.   //write out filler div
  32.   var tmp_html = "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><DIV id='filler' style=\"visibility:visible;position:absolute;" + START_TEXT_Y + ";left:" + START_TEXT_X + ";\"> </DIV>";
  33.   document.write(tmp_html);
  34.   
  35.   //write copyright
  36.   write_copyright(parseInt(START_TEXT_X)+50,parseInt(START_TEXT_Y)+250);
  37.   if ((DT_DESC.length > 1) && (CUR_DT == -1)) {
  38.     write_start_screen(parseInt(START_TEXT_X)+100,START_TEXT_Y);
  39.     write_dt_dlg(START_TEXT_X,START_TEXT_Y);
  40.     obj_style = get_obj_style("DT_DLG");
  41.     obj_style.visibility = 'visible';
  42.     if (INC_START_COPYRIGHT)  {
  43.       obj_style = get_obj_style("Copyright_" + ISO_LANG);
  44.       obj_style.visibility = 'visible';
  45.     }
  46.   }
  47.   else  {
  48.     if (CUR_DT < 0)
  49.       CUR_DT = 0;
  50.     ISO_LANG = DT_LANG[CUR_DT];
  51.     RUN_508 = DT_RUN_508[CUR_DT];
  52.     write_start_screen(parseInt(START_TEXT_X)+100,START_TEXT_Y);
  53.     if (INC_START_COPYRIGHT)  {
  54.       obj_style = get_obj_style("Copyright_" + ISO_LANG);
  55.       obj_style.visibility = 'visible';
  56.     }
  57.     obj_style = get_obj_style("PleaseWait_" + ISO_LANG);
  58.     obj_style.visibility = 'visible';
  59.     run_sco();
  60.   }
  61. }
  62.  
  63. function set_dt(tmp_dt)
  64. {
  65.   CUR_DT = tmp_dt;
  66.   ISO_LANG = DT_LANG[CUR_DT];
  67.   RUN_508 = DT_RUN_508[CUR_DT];
  68.   
  69.   var obj_style = get_obj_style("DT_DLG");
  70.   obj_style.visibility = 'hidden';
  71.   if ((INC_START_COPYRIGHT) && (CUR_DT != 0))  {
  72.     obj_style = get_obj_style("Copyright_" + DT_LANG[0]);
  73.     obj_style.visibility = 'hidden';
  74.     obj_style = get_obj_style("Copyright_" + ISO_LANG);
  75.     obj_style.visibility = 'visible';
  76.   }
  77.   obj_style = get_obj_style("PleaseWait_" + ISO_LANG);
  78.   obj_style.visibility = 'visible';
  79.   run_sco();
  80. }
  81.  
  82. function run_sco()
  83. {
  84.  
  85.     if (!FILE_LMS)
  86.         SCORM_API = get_api();
  87.     else
  88.         SCORM_API = null;
  89.  
  90.     if (SCORM_API != null)  {
  91.         if (SCORM_API.LMSInitialize('') == "true")
  92.             SCORM_INITIALIZED = true;
  93.  
  94.         if (SCORM_API.LMSGetLastError() != 0)
  95.             SCORM_INITIALIZED = false;
  96.     }
  97.  
  98.   var OLD_ISO_LANG = ISO_LANG;
  99.   
  100.     //set status if needed
  101.   SCO_STATUS = get_sco_status('1');
  102.   if (SCO_STATUS == 'n')  {
  103.     set_sco_status('1','i');
  104.     SCO_STATUS = 'i';
  105.   }
  106.   
  107.   var sco_page = 0;
  108.   var sco_location = get_sco_location('1') + "";
  109.   if ((sco_location != '') && (sco_location != null)) {
  110.     sco_location = sco_location.toLowerCase();
  111.     if (!isNaN(sco_location))
  112.       sco_page = parseInt(sco_location);
  113.   }
  114.   
  115.   if ((!SCORM_INITIALIZED) && (!FILE_LMS) && (SHOW_LMS_WARNING))
  116.     alert("Unable to connect to a LMS.");
  117.  
  118.   var pw_obj_style = get_obj_style("PleaseWait_" + OLD_ISO_LANG);
  119.   pw_obj_style.visibility = 'hidden';
  120.   var run_obj_style = get_obj_style("Running_" + ISO_LANG);
  121.   run_obj_style.visibility = 'visible';
  122.  
  123.     if (get_url_value("location")=="yes")
  124.         var show_location = "yes";
  125.     else
  126.         var show_location = "no";
  127.   
  128.   var sco_url = "";
  129.  
  130.   //get page from current display type page list
  131.   DT_PAGES = DISPLAY_TYPES[CUR_DT];
  132.   if (DT_PAGES == "")
  133.     DT_PAGES = get_auto_page_list(MAX_PAGE_NUM);
  134.   DT_PAGE_LIST = DT_PAGES.split(",");
  135.   MAX_PAGE_NUM = DT_PAGE_LIST.length;
  136.   if ((sco_page < 1) || (sco_page > MAX_PAGE_NUM))
  137.     sco_page = 1;
  138.  
  139.     if (sco_page > 1) {
  140.         myAns = confirm("Do you wish to continue where you left off?"," ");
  141.         if (myAns == false)
  142.             sco_page = 1;
  143.     }
  144.  
  145.   CUR_PAGE_ID = DT_PAGE_LIST[sco_page-1];
  146.  
  147.   if (!LCMS_REVIEW)
  148.     PAGE_NUM = sco_page;
  149.     
  150.   if (item_in_array(CUR_PAGE_ID,PAGE_TYPES[PT_FLASH].split(",")))  {
  151.     sco_url = FLASH_PAGE_ROOT;
  152.   }
  153.   else  {
  154.     sco_url = CUR_PAGE_ID + ".htm";
  155.   }
  156.  
  157.   if (RUN_TYPE == "netg")  {
  158.     sco_url = "../karta_launcher.htm?action=0";
  159.   }
  160.   
  161.   if (RUN_TYPE == "flms")  {
  162.     var tmp_user_id = get_user_name();
  163.     if (tmp_user_id == "")
  164.       tmp_user_id = PROG_ID;
  165.     set_flms_cookie_data(PROG_ID,tmp_user_id);
  166.     sco_url = "text_only/mode.htm?user_id=" + tmp_user_id;
  167.   }
  168.  
  169.   if (sco_url != "")  {
  170.     if (WIN_TYPE == "new_window") {
  171.         CONTENT_WIN = open(sco_url,"ContentWin", CONTENT_POS + "scrollbars=" + CONTENT_SCROLL + ",resizable=" + CONTENT_RESIZE + ",width=" + CONTENT_WIDTH +  ",height=" + CONTENT_HEIGHT + ",toolbar=no,directories=no,menubar=no,status=yes,location=" + show_location + ",");
  172.         TIMER_INTERVAL_ID = setInterval("check_content_win();",1000);
  173.     }
  174.     else  {
  175.       if (WIN_TYPE == "frame")  {
  176.         if (window.parent.training != null) {
  177.           CONTENT_WIN = window.parent.training;
  178.           CONTENT_WIN.location.href=sco_url;
  179.           resize_window(CONTENT_WIN,window.parent);
  180.         }
  181.       }
  182.       else  {
  183.         API_WIN.WIN_TYPE = WIN_TYPE;
  184.         API_WIN.MAX_PAGE_NUM = MAX_PAGE_NUM;
  185.         API_WIN.PAGE_NUM = PAGE_NUM;
  186.         location.href = sco_url;
  187.       }
  188.     }
  189.   }
  190.   else  {
  191.     alert("An error has occurred. No content page has been specified.");
  192.   }
  193. }
  194.  
  195. function check_content_win()
  196. {
  197.     if (CONTENT_WIN.closed) { 
  198.         sco_finish();
  199.     }
  200.     else  {
  201.     if ((SCORM_INITIALIZED) && (RUN_TYPE == "netg"))  {
  202.       TIME_OUT_TIMER += 1;
  203.       if (TIME_OUT_TIMER == 60) {
  204.         TIME_OUT_TIMER = 0;
  205.         tmp_ls = SCORM_API.LMSGetValue("cmi.core.lesson_status");
  206.         if (SCORM_API.LMSGetLastError() != 0) {        
  207.           if (TIMER_INTERVAL_ID != "")
  208.                 clearInterval(TIMER_INTERVAL_ID);
  209.           alert("An error communicating to the LMS has occured.\nPlease exit the training and contact your training administrator.");
  210.           sco_finish();
  211.         }
  212.       }
  213.     }
  214.   }
  215. }
  216. function set_sco_status(sub_sco,status)
  217. {
  218.   //only set sco status if sub_sco is a sub sco, 
  219.   //sub_sco is the main sco (1) and there is no mandatory DT (MANDATORY_DT = -1), OR
  220.   //sub_sco is the main sco (1) and the current dt (CUR_DT) is the mandatory DT
  221.   if ((parseInt(sub_sco) > 1) || ((parseInt(sub_sco) == 1) && (MANDATORY_DT == -1)) || ((parseInt(sub_sco) == 1) && (MANDATORY_DT == CUR_DT)))  {
  222.     var cur_status = get_sco_status(sub_sco);
  223.     if (((cur_status != "c") && (cur_status != "p")) && ((cur_status != "f") || ((cur_status == "f") && (status == "p"))))  {
  224.       status = parse_sco_status(status);
  225.       if (SCORM_INITIALIZED)  {
  226.         if (sub_sco.toString() == "1")  {
  227.           SCORM_API.LMSSetValue("cmi.core.lesson_status",convert_sco_status(status));
  228.           SCORM_API.LMSCommit('');
  229.         }
  230.         else  {
  231.           set_scorm_data("cmi.suspend_data","sss_" + CUR_SCO + "_" + sub_sco,status);
  232.         }
  233.       }
  234.       if (FILE_LMS) {
  235.         flms_set_sco_status(CUR_SCO,sub_sco,status);
  236.         document.cookie = "SCO_STATUS=" + status + "; path=" + COOKIE_PATH + ";";
  237.       }
  238.       if (sub_sco.toString() == "1")
  239.         SCO_STATUS = status;
  240.     }
  241.   }
  242. }
  243. function get_sco_status(sub_sco)
  244. {
  245.   var tmp_return = "";
  246.   if (SCORM_INITIALIZED)  {
  247.     if (sub_sco.toString() == "1")  {
  248.       tmp_return = parse_sco_status(SCORM_API.LMSGetValue("cmi.core.lesson_status"));
  249.     }
  250.     else  {
  251.       tmp_return = get_scorm_data("cmi.suspend_data","sss_" + CUR_SCO + "_" + sub_sco);
  252.     }
  253.   }
  254.   if (FILE_LMS) {
  255.     tmp_return = flms_get_sco_status(CUR_SCO,sub_sco);
  256.   }
  257.   return tmp_return;
  258. }
  259.  
  260. function set_sco_location(sub_sco,location)
  261. {
  262.   if (SCORM_INITIALIZED)  {
  263.     set_scorm_data("cmi.core.lesson_location",CUR_SCO + "_" + CUR_DT + "_" + sub_sco,location);
  264.   }
  265.   if (FILE_LMS) {
  266.     flms_set_sco_loc(CUR_SCO,CUR_DT,sub_sco,location);
  267.   }  
  268. }
  269.  
  270. function get_sco_location(sub_sco)
  271. {
  272.   var tmp_return = "";
  273.   if (SCORM_INITIALIZED)  {
  274.     tmp_return = get_scorm_data("cmi.core.lesson_location",CUR_SCO + "_" + CUR_DT + "_" + sub_sco);
  275.   }
  276.   if (FILE_LMS) {
  277.     tmp_return = flms_get_sco_loc(CUR_SCO,CUR_DT,sub_sco);
  278.   }
  279.   return tmp_return;
  280. }
  281.  
  282. function set_sco_score(score)
  283. {
  284.   if ((!isNaN(score)) && (SCORM_INITIALIZED)) {
  285.     var old_score = get_sco_score();
  286.     var do_it = false;
  287.     if (!isNaN(old_score)) {
  288.       if (parseFloat(score) > parseFloat(old_score))
  289.         do_it = true;
  290.     }
  291.     else
  292.       do_it = true;
  293.  
  294.     if (do_it)  {
  295.       SCORM_API.LMSSetValue("cmi.core.score.raw",score.toString());
  296.         SCORM_API.LMSCommit('');
  297.     }
  298.   }
  299. }
  300.  
  301. function get_sco_score()
  302. {
  303.   var tmp_return = "";
  304.   if (SCORM_INITIALIZED)
  305.     tmp_return = get_raw_score();
  306.   return tmp_return;
  307. }
  308.  
  309. function set_session_time(session_time)
  310. {
  311.   if ((session_time != "") && (session_time != null)) {
  312.     if (SCORM_INITIALIZED)  {
  313.       SCORM_API.LMSSetValue("cmi.core.session_time",session_time.toString());
  314.       SCORM_API.LMSCommit('');
  315.     }
  316.   }
  317. }
  318.  
  319. function set_lang(tmp_iso_lang)
  320. {
  321.  
  322.   //change display text
  323.   var pw_obj_style = get_obj_style("PleaseWait_" + ISO_LANG);
  324.   var run_obj_style = get_obj_style("Running_" + ISO_LANG);
  325.   var done_obj_style = get_obj_style("Done_" + ISO_LANG);
  326.   var copy_obj_style = get_obj_style("Copyright_" + ISO_LANG);
  327.  
  328.   if (pw_obj_style.visibility == 'visible') {
  329.     //hide current obj, show other language
  330.     pw_obj_style.visibility = 'hidden';
  331.     pw_obj_style = get_obj_style("PleaseWait_" + tmp_iso_lang);
  332.     pw_obj_style.visibility = 'visible';
  333.   }
  334.  
  335.   if (run_obj_style.visibility == 'visible') {
  336.     //hide current obj, show other language
  337.     run_obj_style.visibility = 'hidden';
  338.     run_obj_style = get_obj_style("Running_" + tmp_iso_lang);
  339.     run_obj_style.visibility = 'visible';
  340.   }
  341.  
  342.   if (done_obj_style.visibility == 'visible') {
  343.     //hide current obj, show other language
  344.     done_obj_style.visibility = 'hidden';
  345.     done_obj_style = get_obj_style("Done_" + tmp_iso_lang);
  346.     done_obj_style.visibility = 'visible';
  347.   }
  348.  
  349.   copy_obj_style.visibility = 'hidden';
  350.   copy_obj_style = get_obj_style("Copyright_" + tmp_iso_lang);
  351.   copy_obj_style.visibility = 'visible';
  352.  
  353.   //save value in this window
  354.   ISO_LANG = tmp_iso_lang;
  355. }
  356.  
  357. function sco_finish()
  358. {
  359.  
  360.   set_browse(BROWSE);
  361.  
  362.     //stop timer
  363.     if (TIMER_INTERVAL_ID != "")
  364.         clearInterval(TIMER_INTERVAL_ID);
  365.     
  366.   //close all children windows
  367.   close_child_windows("exit_sco",window.name);
  368.   
  369.   var run_obj_style = get_obj_style("Running_" + ISO_LANG);
  370.   run_obj_style.visibility = 'hidden';
  371.   var done_obj_style = get_obj_style("Done_" + ISO_LANG);
  372.   done_obj_style.visibility = 'visible';
  373.   
  374.   //run scoFinish in LCMS Review WIN if enabled
  375.   if (LCMS_REVIEW)  {
  376.     var tmp_url = LCMS_REVIEW_PATH + LCMS_LMSFINISH_PAGE + "&displayTypeIndex=" + CUR_DT;
  377.     open_lcms_review(tmp_url);
  378.     window.close();
  379.   }
  380.   else  {     
  381.     if ((FILE_LMS) || (RUN_TYPE == "flms")) {
  382.       flms_sco_finish("../menu.htm");
  383.       if (SCORM_INITIALIZED)  {
  384.             SCORM_API.LMSFinish('');
  385.         }
  386.     }
  387.     else  {
  388.       if (SCORM_INITIALIZED)  {
  389.             SCORM_API.LMSFinish('');
  390.         }
  391.       if ((!SCORM_INITIALIZED) && (NO_LMS_URL != ""))
  392.         location.href = NO_LMS_URL;
  393.     }
  394.   }
  395. }
  396.  
  397. function getAICCHost()
  398. {
  399.     var aiccHost = "http://ilearning.oracle.com";
  400.     var queryString = unescape(location.search);
  401.  
  402.     if (queryString != null && queryString.length > 0)
  403.     {
  404.        // Chop the '?' off
  405.        if (queryString.charAt(0) == '?') {
  406.           queryString = queryString.slice(1);
  407.        }
  408.  
  409.        // Split the remaining query string into an array, delimited
  410.        // by '&'
  411.        var queryParameters = queryString.split("&");
  412.  
  413.        // Now loop over the elements of the array, looking for one
  414.        // that starts with "AICC_URL="
  415.        for (var i = 0; i < queryParameters.length; i++) {
  416.           if (queryParameters[i].toUpperCase().substring(0, 9) == "AICC_URL=") {
  417.  
  418.              // Found it, grab the part after "AICC_URL="
  419.              var aiccUrl = queryParameters[i].slice(9);
  420.  
  421.              // Now find the index of the third slash, and grab everything
  422.              // up to that point.  We assume it will start with "http://" or
  423.              // "https://".  This could be improved...
  424.              var slashIndex = 0;
  425.              slashIndex = aiccUrl.indexOf("/", slashIndex);
  426.              slashIndex = aiccUrl.indexOf("/", slashIndex + 1);
  427.              slashIndex = aiccUrl.indexOf("/", slashIndex + 1);
  428.              if (slashIndex == -1) {
  429.                 aiccHost = aiccUrl;
  430.              } else {
  431.                 aiccHost = aiccUrl.substring(0, slashIndex);
  432.              }
  433.           }
  434.        }
  435.     }
  436.  
  437.     return aiccHost;
  438. }
  439.  
  440. function get_user_name()
  441. {
  442.   myReturn = "";
  443.   if (SCORM_INITIALIZED)  {
  444.     myReturn = SCORM_API.LMSGetValue("cmi.core.student_id");
  445.     if (SCORM_API.LMSGetLastError() != "0")
  446.       myReturn = "";
  447.   }
  448.   if (FILE_LMS) {
  449.     myReturn = TEMP_USER;
  450.   }
  451.   if ((myReturn == "") && (RUN_TYPE == "flms"))
  452.     myReturn = PROG_ID;
  453.   return myReturn;
  454. }
  455.  
  456. function get_scorm_data(scorm_key,key)
  457. {
  458.   var value = "";
  459.   if (SCORM_INITIALIZED)  {
  460.     var tmp_value = get_list_value(key,SCORM_API.LMSGetValue(scorm_key),PAIR_DELIMITER,VALUE_DELIMITER,"")
  461.     if (tmp_value != "")  {
  462.       if (USE_HEX_ENCODING)
  463.         value = convert_from_hex(tmp_value);
  464.       else
  465.         value = tmp_value;
  466.     }
  467.   }
  468.   return value;
  469. }
  470.  
  471. function set_scorm_data(scorm_key,key,value)
  472. {
  473.   if (SCORM_INITIALIZED)  {
  474.     var tmp_data = SCORM_API.LMSGetValue(scorm_key);
  475.     var tmp_value = "";
  476.     if (USE_HEX_ENCODING)
  477.       tmp_value = convert_to_hex(value + "");
  478.     else
  479.       tmp_value = value + "";
  480.     tmp_data = set_list_value(key,tmp_value,tmp_data,PAIR_DELIMITER,VALUE_DELIMITER);
  481.     SCORM_API.LMSSetValue(scorm_key,tmp_data);
  482.     SCORM_API.LMSCommit('');
  483.   }
  484. }
  485.  
  486.  
  487.  
  488. function set_flms_cookie_data(tmp_prog_id,tmp_user_id)
  489. {
  490.   if (SCORM_INITIALIZED)  {
  491.     var tmp_data = get_scorm_data("cmi.suspend_data","flms_user");
  492.     flms_set_cookie_data(tmp_prog_id,tmp_user_id,"user",tmp_data);
  493.     tmp_data = get_scorm_data("cmi.suspend_data","flms_status");
  494.     flms_set_cookie_data(tmp_prog_id,tmp_user_id,"status",tmp_data);
  495.     for (i=0;i<DISPLAY_TYPES.length;i++)  {
  496.       tmpChar = i.toString();
  497.       tmp_data = get_scorm_data("cmi.suspend_data","flms_loc_" + tmpChar);
  498.       flms_set_cookie_data(tmp_prog_id,tmp_user_id,"loc_" + tmpChar,tmp_data);
  499.     }
  500.   }
  501. }
  502.  
  503. function get_flms_cookie_data(tmp_prog_id,tmp_user_id)
  504. {
  505.   var tmp_data = flms_get_cookie_data(tmp_prog_id,tmp_user_id,"user");
  506.   set_scorm_data("cmi.suspend_data","flms_user",tmp_data);
  507.   tmp_data = flms_get_cookie_data(tmp_prog_id,tmp_user_id,"status");
  508.   set_scorm_data("cmi.suspend_data","flms_status",tmp_data);
  509.   for (i=0;i<DISPLAY_TYPES.length;i++)  {
  510.     tmpChar = i.toString();
  511.     tmp_data = flms_get_cookie_data(tmp_prog_id,tmp_user_id,"loc_"+tmpChar);
  512.     set_scorm_data("cmi.suspend_data","flms_loc_"+tmpChar,tmp_data);
  513.   }
  514. }
  515.  
  516. function get_raw_score()
  517. {
  518.   var score = null;
  519.   if (SCORM_INITIALIZED)  {
  520.     var tmp_score = SCORM_API.LMSGetValue("cmi.core.score.raw");
  521.     if (tmp_score != "")
  522.       score = tmp_score;
  523.   }
  524.   return score;
  525. }
  526.  
  527. function parse_sco_status(sco_status)
  528. {
  529.   sco_status = sco_status.toLowerCase();
  530.   if ((sco_status == "n") || (sco_status == "c") || (sco_status == "i") || (sco_status == "p") || (sco_status == "f"))
  531.     return sco_status;
  532.   else  {
  533.     if (sco_status == "not attempted")
  534.       return "n";
  535.     if (sco_status == "incomplete")
  536.       return "i";
  537.     if (sco_status == "completed")
  538.       return "c";
  539.     if (sco_status == "passed")
  540.       return "p";
  541.     if (sco_status == "failed")
  542.       return "f";
  543.     if (sco_status == "na")
  544.       return "n";
  545.   }
  546.   return "";
  547. }
  548.  
  549. function convert_sco_status(sco_status)
  550. {
  551.   sco_status = sco_status.toLowerCase();
  552.   if ((sco_status == "c") || (sco_status == "i") || (sco_status == "n") || (sco_status == "na") || (sco_status == "p") || (sco_status == "f")) {
  553.       if (sco_status == "na")
  554.         return "not attempted";
  555.       if (sco_status == "n")
  556.         return "not attempted";
  557.       if (sco_status == "i")
  558.         return "incomplete";
  559.       if (sco_status == "c")
  560.         return "completed";
  561.       if (sco_status == "p")
  562.         return "passed";
  563.       if (sco_status == "f")
  564.         return "failed";
  565.   }
  566.   return "";
  567. }
  568.  
  569. function write_start_screen(x_pos,y_pos)
  570. {
  571.   var wait_txt_en = "<DIV ID='PleaseWait_en' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:16px;color:#000000;font-weight:bold;\">Please wait for the training to load...</DIV>";
  572.   var wait_txt_es = "<DIV ID='PleaseWait_es' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:16px;color:#000000;font-weight:bold;\">Por favor espere el programa mientras cargar...</DIV>";
  573.  
  574.   var running_txt_en = "<DIV id='Running_en' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:16px;color:#000000;font-weight:bold;\">Training is currently running...</DIV>";
  575.   var running_txt_es = "<DIV id='Running_es' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:16px;color:#000000;font-weight:bold;\">El entrenamiento se encuentra en processo...</DIV>";
  576.  
  577.   var done_txt_en = "<DIV id='Done_en' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:16px;color:#000000;font-weight:bold;\">Your learning session has ended.";
  578.   var done_txt_es = "<DIV id='Done_es' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:16px;color:#000000;font-weight:bold;\">Su sesi≤n de aprendizaje ha finalizado.";
  579.   if (ILEARNING)  {
  580.     done_txt_en += "<P>To return to iLearning training menu,<BR>click on the 'Home' button on the iLearning menu bar.<P>To continue to the next training item,<BR>click the next arrow in the iLearning menu bar or<BR>select it in the course outline.</DIV>";
  581.     done_txt_es += "<P>Para volver al men· de entrenamiento en iLearning, <BR>presione 'Home' en la barra de men· de iLearning.<P>Para continuar con la pr≤xima lecci≤n de entrenamiento, <BR>presione la flecha de la derecha en la barra de men· de<BR>iLearning o selecionela en el curso.</DIV>";
  582.   }
  583.   else  {
  584.     done_txt_en += "</DIV>";
  585.     done_txt_es += "</DIV>";
  586.   }
  587.  
  588.     var tmp_html = wait_txt_en + wait_txt_es + running_txt_en + running_txt_es + done_txt_en + done_txt_es;
  589.  
  590.   document.write(tmp_html);
  591. }
  592.  
  593. function write_dt_dlg(x_pos,y_pos)
  594. {
  595.   var tmp_html = "<DIV ID='DT_DLG' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";width:500;font-family:arial;font-size:16px;color:#000000;font-weight:normal;\">This training object is available in multiple methods of display. Please select a display type from the following list:<P>";
  596.   //add display types
  597.   for (i=0;i<DT_DESC.length;i++)  {
  598.     tmp_html += "<A href='javascript:set_dt(" + i + ");'>" + DT_DESC[i] + "</a>";
  599.     if (MANDATORY_DT > -1)  {
  600.       if (MANDATORY_DT == i)
  601.         tmp_html += "  <font style='font-size:12px;'>(mandatory)</font>";
  602.       else
  603.         tmp_html += "  <font style='font-size:12px;'>(optional)</font>";
  604.     }
  605.     tmp_html += "<P>";
  606.   }
  607.   if (MANDATORY_DT > -1)  {
  608.     tmp_html += "<P><b>Please Note</b>:<BR>You must complete the <u>" + DT_DESC[MANDATORY_DT] + "</u> display type in order to complete this training object.";
  609.   }
  610.   else  {
  611.     tmp_html += "<P><b>Please Note</b>:<BR>The completion of any of the above display types will complete this training object.";
  612.   }
  613.   
  614.   tmp_html += "</DIV>";
  615.  
  616.   document.write(tmp_html);
  617. }
  618.  
  619. function write_copyright(x_pos,y_pos)
  620. {
  621.   var copyright_txt_en = "<DIV id='Copyright_en' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:11px;color:#000000;\">";
  622.   var copyright_txt_es = "<DIV id='Copyright_es' style=\"visibility:hidden;position:absolute;top:" + y_pos + ";left:" + x_pos + ";font-family:arial;font-size:11px;color:#000000;\">";
  623.  
  624.   if (INC_START_COPYRIGHT)  {
  625.     copyright_txt_en += "Copyright ⌐ 2003-2004 Karta Technologies, Inc. All Rights Reserved</DIV>";
  626.     copyright_txt_es += "Derechos de Autor . Copyright ⌐ 2003-2004 Karta Technologies, Inc. Todos los Derechos Reservados.</DIV>";
  627.   }
  628.   else  {
  629.     copyright_txt_en += "</DIV>";
  630.     copyright_txt_es += "</DIV>";
  631.   }
  632.   var tmp_html = copyright_txt_en + copyright_txt_es;
  633.   document.write(tmp_html);
  634. }
  635.  
  636. function get_content_url(page_id,page_type)
  637. {
  638.   var tmp_return = "";  
  639.   if (page_type == "flash")
  640.     tmp_return = FLASH_PAGE_ROOT;
  641.   if (page_type == "html")  {
  642.     tmp_return = page_id + ".htm";
  643.   }
  644.   return tmp_return;
  645. }
  646.  
  647. function get_flash_html(file_url,movie_width,movie_height,bkgrd_color,flash_version)
  648. {
  649.   var tmp_flash_params = get_flash_params();
  650.   return "<SPAN id='flash_obj' style='display:none;'><OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='" + URL_PREFIX + "download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + flash_version + "' WIDTH='" + movie_width + "' HEIGHT='" + movie_height + "' id='flashplayer' ALIGN=''><PARAM NAME=movie VALUE='" + file_url + "?" + tmp_flash_params + "'><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=" + bkgrd_color + "><PARAM NAME='menu' VALUE='false'><PARAM NAME=FlashVars VALUE='" + tmp_flash_params + "'><EMBED src='" + file_url + "?" + tmp_flash_params + "' quality=high bgcolor=" + bkgrd_color + "  WIDTH='" + movie_width + "' HEIGHT='" + movie_height + "' NAME='flash_player' FlashVars='" + tmp_flash_params + "' menu='false' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='" + URL_PREFIX + "www.macromedia.com/go/getflashplayer'></EMBED></OBJECT></SPAN>";
  651. }
  652.  
  653. function get_wma_html(file_url)
  654. {
  655.   return "<OBJECT ID='MediaPlayer1' NAME='MediaPlayer1' WIDTH=1 HEIGHT=1 style='position:absolute;top:0;left:0;' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' CODEBASE='" + URL_PREFIX + "activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' standby='Loading Microsoft Windows Media Player components...' TYPE='application/x-oleobject'><PARAM NAME='FileName' VALUE='" + file_url + "'><PARAM NAME='AnimationatStart' VALUE='false'><PARAM NAME='TransparentatStart' VALUE='true'><PARAM NAME='AutoStart' VALUE='true'><PARAM NAME='AutoSize' Value='true'><PARAM NAME='ShowControls' VALUE=0><EMBED TYPE='application/x-mplayer2' SRC='" + file_url + "' NAME='MediaPlayer1' ID='MediaPlayer1' WIDTH=5 HEIGHT=5 SHOWCONTROLS='false'></EMBED></OBJECT>";
  656. }
  657.  
  658. function get_flash_params()
  659. {
  660.   var return_data = "";
  661.   if ((FILE_LMS) || (RUN_TYPE == "flms"))  {
  662.     tmp_user_id = get_user_name();
  663.     tmp_cur_sco = flms_get_cur_sco();
  664.     if ((tmp_user_id != "") && (tmp_cur_sco != ""))
  665.       return_data = flms_get_flash_params(PROG_ID,tmp_user_id,tmp_cur_sco,CUR_DT);
  666.     else
  667.       alert("PROBLEM!");
  668.   }
  669.   else  {
  670.     //REGULAR SCORM MODE
  671.     //retrieve values from suspend_data
  672.   }
  673.   return return_data
  674. }
  675.  
  676. function get_page_type(page_id)
  677. {
  678.   var tmp_return = "";
  679.   if (item_in_array(page_id,PAGE_TYPES[PT_FLASH].split(",")))
  680.     tmp_return = "flash";
  681.   if (item_in_array(page_id,PAGE_TYPES[PT_HTML].split(",")))
  682.     tmp_return = "html";
  683.   return tmp_return;
  684. }
  685.  
  686. function get_audio_type(page_id)
  687. {
  688.   var tmp_return = "";
  689.   if (item_in_array(page_id,AUDIO_TYPES[AT_FLASH].split(",")))
  690.     tmp_return = "flash";
  691.   if (item_in_array(page_id,AUDIO_TYPES[AT_WMA].split(",")))
  692.     tmp_return = "wma";
  693.   return tmp_return;
  694. }
  695.  
  696. function get_media_url(page_id,media_type)
  697. {
  698.   var tmp_return = "";
  699.   if (media_type == "flash")
  700.     tmp_return  = "media/" + page_id + ".swf";
  701.   if (media_type == "wma")
  702.     tmp_return  = "media/" + page_id + ".wma";
  703.   return tmp_return;
  704. }
  705.  
  706. function get_audio_url(page_id)
  707. {
  708.   return "audio/aud_" + page_id + ".htm";
  709. }
  710.  
  711. function open_audio_win(audio_file)
  712. {
  713.     if (SHOW_AUDIO) {
  714.     if ((AUDIO_WIN == null) || (AUDIO_WIN.closed))
  715.           AUDIO_WIN = window.open(audio_file,"AUDIOWIN","toolbar=no,menubar=no,location=no,height=" + AUDIO_WIN_HEIGHT + ",width=" + AUDIO_WIN_WIDTH + ",resizable=" + AUDIO_WIN_RESIZE + ",scrollbars=" + AUDIO_WIN_SCROLL + ",top=" + AUDIO_WIN_TOP + ",left=" + AUDIO_WIN_LEFT);
  716.     else
  717.       AUDIO_WIN.document.location.href = audio_file;
  718.         AUDIO_WIN.focus();
  719.     }
  720. }
  721.  
  722. function close_child_windows(exit_type,win_name)
  723. {
  724.   if (exit_type == "exit_sco")  {
  725.       if (AUDIO_WIN != null)  {
  726.           AUDIO_WIN.close();
  727.       AUDIO_WIN = null;
  728.     }
  729.     if (CONTENT_WIN != null)  {
  730.           CONTENT_WIN.close();
  731.       CONTENT_WIN = null;
  732.     }
  733.   }
  734.     if (GLOSS_WIN != null)  {
  735.       GLOSS_WIN.close();
  736.     GLOSS_WIN = null;
  737.   }
  738.   if ((!RUN_REVIEW) || ((RUN_REVIEW) && (win_name != "REVIEW_WIN"))){
  739.     if (RV_WIN != null) {
  740.       if (!RV_WIN.closed)
  741.         RV_WIN.close();
  742.       RV_WIN = null;
  743.     }
  744.     RUN_REVIEW = false;
  745.   }
  746.   if (PREFS_WIN != null)  {
  747.     PREFS_WIN.close();
  748.     PREFS_WIN = null;
  749.   }
  750.   if (REFS_WIN != null)  {
  751.     REFS_WIN.close();
  752.     REFS_WIN = null;
  753.   }
  754.   if (HELP_WIN != null)  {
  755.     HELP_WIN.close();
  756.     HELP_WIN = null;
  757.   }
  758.   if (POPUP_WIN != null)  {
  759.     POPUP_WIN.close();
  760.     POPUP_WIN = null;
  761.   }
  762.   if (MAP_WIN != null)  {
  763.     MAP_WIN.close();
  764.     MAP_WIN = null;
  765.   }
  766. }
  767.  
  768. function open_glossary(term) 
  769. {
  770.   if ((term == null) || (term == ''))
  771.     gloss_target = "../glossary/glossary_" + ISO_LANG + ".htm";
  772.   else
  773.     gloss_target = "../glossary/terms_" + ISO_LANG + "/" + term + ".htm";
  774.     GLOSS_WIN=open(gloss_target,"GLOSSWIN","scrollbars=yes,resizable=no,width=450,height=250,toolbar=no,directories=no,menubar=no,status=no,");
  775.   GLOSS_WIN.focus();
  776. }
  777.  
  778. function open_prefs()
  779. {
  780.   PREFS_WIN = open("../includes/prefs_form_" + ISO_LANG + ".htm","PREFSWIN","scrollbars=no,resizeable=no,width=250,height=150,toolbar=no,directories=no,menubar=no,status=no,");
  781.   PREFS_WIN.focus();
  782. }
  783.  
  784. function open_refs()
  785. {
  786.   REFS_WIN=open("../resources/resources_" + ISO_LANG + ".htm","REFSWIN","location=no,scrollbars=yes,resizable=yes,width=" + REFS_WIDTH + ",height=" + REFS_HEIGHT + ",toolbar=no,directories=no,menubar=no,status=yes,");
  787.   REFS_WIN.focus();
  788. }
  789.  
  790. function open_help()
  791. {
  792.   HELP_WIN=open("../help/help_" + ISO_LANG + ".htm","HELPWIN","location=no,scrollbars=yes,resizable=yes,width=" + HELP_WIDTH + ",height=" + HELP_HEIGHT + ",toolbar=no,directories=no,menubar=no,status=yes,");
  793.   HELP_WIN.focus();
  794. }
  795.  
  796. function open_map()
  797. {
  798.  MAP_WIN=open("../includes/course_map.htm#lesson-"+CUR_SCO,"MAPWIN","location=no,scrollbars=yes,resizable=yes,width=550,height=400,toolbar=no,directories=no,menubar=no,status=yes,");
  799.   MAP_WIN.focus();
  800. }
  801.  
  802. function open_lcms_review(page_url)
  803. {
  804.   LCMS_REVIEW_WIN=open(page_url,"LCMSREVIEWWIN","location=no,scrollbars=yes,resizable=yes,width=" + LCMS_REVIEW_WIDTH + ",height=" + LCMS_REVIEW_HEIGHT + ",toolbar=no,directories=no,menubar=no,status=yes,");
  805.   if (CONTENT_WIN != null)  {
  806.     if (!CONTENT_WIN.closed)
  807.       CONTENT_WIN.focus();
  808.   }
  809. }
  810.  
  811. function resize_window(win_obj,resize_win_obj)
  812. {
  813.     var tmp_x = 0;
  814.     var tmp_y = 0;
  815.     if (IE) {
  816.       tmp_x = win_obj.document.body.clientWidth;
  817.       tmp_y = win_obj.document.body.clientHeight;
  818.     }
  819.     else  {
  820.       tmp_x = win_obj.innerWidth;
  821.       tmp_y = win_obj.innerHeight;
  822.     }
  823.     if ((tmp_x > 0) && (tmp_y > 0)) {
  824.       var tmp_x_offset = parseInt(CONTENT_WIDTH) - tmp_x;
  825.       var tmp_y_offset = parseInt(CONTENT_HEIGHT) - tmp_y;
  826.       //alert(tmp_x_offset);
  827.       //resize_win_obj.resizeTo(parseInt(CONTENT_WIDTH)+tmp_x_offset,parseInt(CONTENT_HEIGHT)+tmp_y_offset)
  828.       resize_win_obj.resizeBy(tmp_x_offset,tmp_y_offset);
  829.     }
  830. }
  831.